package com.deuwise.system.entity;

import com.baomidou.mybatisplus.activerecord.Model;
import com.baomidou.mybatisplus.annotations.TableId;
import com.baomidou.mybatisplus.annotations.TableName;
import com.baomidou.mybatisplus.annotations.TableField;
import com.deuwise.common.validator.group.AddGroup;
import com.deuwise.common.validator.group.UpdateGroup;
import io.swagger.annotations.ApiModelProperty;
import lombok.Data;
import lombok.EqualsAndHashCode;
import org.hibernate.validator.constraints.Length;

import javax.validation.constraints.NotBlank;
import java.io.Serializable;
import java.util.Date;

/**
 * 
 *@author deuwise
 *@date 2018-11-20 10:36:29
 */
@Data
@EqualsAndHashCode(callSuper=true)
@TableName("sys_app")
public class AppDo extends Model<AppDo> implements Serializable{
    /**主键id*/
    @ApiModelProperty("主键id")
    @TableId("id")
    private String id;

    /**应用名称*/
    @ApiModelProperty("应用名称")
    @TableField("name")
    @NotBlank(message = "应用名称不能为空",groups ={AddGroup.class, UpdateGroup.class})
    @Length(max =64,message ="应用名称长度不能超过{max}",groups ={AddGroup.class, UpdateGroup.class})
    private String name;

    /**网页url*/
    @ApiModelProperty("网页url")
    @TableField("url")
    @Length(max =120,message ="网页url长度不能超过{max}",groups ={AddGroup.class, UpdateGroup.class})
    private String url;

    /**类型 0 c/s 1 b/s*/
    @ApiModelProperty("类型 0 c/s 1 b/s")
    @TableField("type")
    private Integer type;

    /**状态 0禁用 1启用*/
    @ApiModelProperty("状态 0禁用 1启用")
    @TableField("status")
    private Integer status;

    /**编码*/
    @ApiModelProperty("编码")
    @TableField("code")
    @NotBlank(message = "编码不能为空",groups ={AddGroup.class})
    private String code;

    @ApiModelProperty("后台url")
    @TableField("back_url")
    @Length(max =120,message ="后台url长度不能超过{max}",groups ={AddGroup.class, UpdateGroup.class})
    private String backUrl;

    @ApiModelProperty("是否开启sso")
    @TableField("enable_sso")
    private Integer enableSso;

    @ApiModelProperty("创建时间")
    @TableField("create_time")
    private Date createTime;

    @ApiModelProperty("修改时间")
    @TableField("update_time")
    private Date updateTime;

    @Override
    protected Serializable pkVal() {
        return id;
    }
}